package com.sj.aopEvolve.cglib;

import org.junit.Test;

/**
 * 测试类
 */
public class App {
    @Test
    public void test2() {
        //目标对象
        UserDao target = new UserDao();
        //代理对象
        UserDaoProxy userDaoProxy = new UserDaoProxy(target);
        target = userDaoProxy;

        UserDao proxy = (UserDao) new ProxyFactory(target).getProxyInstance();
        //执行代理对象的方法
        proxy.save();
    }

    @Test
    public void test() {
        //目标对象
        UserDao target = new UserDao();
        //代理对象
        UserDao proxy = (UserDao) new ProxyFactory(target).getProxyInstance();
        //执行代理对象的方法
        proxy.save();
    }
}
